package jnpf;

import cn.xuyanwu.spring.file.storage.EnableFileStorage;
import jnpf.config.ConfigValueUtil;
import jnpf.engine.util.SpringContextHolder;
import jnpf.init.FlowableLoadUtil;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;


@EnableDiscoveryClient
@EnableFeignClients
@EnableFileStorage
@SpringBootApplication(scanBasePackages = {"jnpf"}, exclude = {DataSourceAutoConfiguration.class})
public class JnpfAdminApplication extends SpringBootServletInitializer {

    public static void main(String[] args) {
        SpringApplication springApplication = new SpringApplication(JnpfAdminApplication.class);
        //添加监听器
        //springApplication.addListeners(new JnpfListener());
        springApplication.run(args);
        ConfigValueUtil configValueUtil = SpringContextHolder.getBean(ConfigValueUtil.class);
        boolean multiTenancy = configValueUtil.isMultiTenancy();
        if(Boolean.FALSE.equals(multiTenancy)){
            FlowableLoadUtil flowableLoadUtil = SpringContextHolder.getBean(FlowableLoadUtil.class);
            flowableLoadUtil.init();
        }
    }




}
